<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<style>
    .box {
        width: 200px;
        height: 100px;
        background-color: hotpink;
    }
</style>
<body>


<div class="box">平安喜乐 万事顺逐</div>

<script>
    const element = document.querySelector('.box');
    element.addEventListener('mouseenter', function () {
        console.log('我来了')
    })
    element.addEventListener('mouseleave', function () {
        console.log('我走了')
    })
</script>
</body>
</html>